<template>
    <div class="wrapper">
        <h2>组件式Tab切换</h2>
        <div class="shape">
            <h3>效果展示</h3>
            <div>
                <Tabs >
                    <Tab title="导航1">内容1</Tab>
                    <Tab title="导航2">内容2</Tab>
                    <Tab title="导航3">内容3</Tab>
                </Tabs> 
            </div>
        </div>
        <div class="markdown-body">
            <pre><code language="html">{{
`<!--请传递一个Tab组件，格式如下-->
<Tabs>
    <Tab title="导航1">内容1</Tab>
    <Tab title="导航2">内容2</Tab>
    <Tab title="导航3">内容3</Tab>
</Tabs> 
`
            }}</code></pre>
        </div>
        <div class="shape">
            <h3 @click="getCode">查看源码</h3>
            <main class="markdown-body" v-show="code">
<pre><code>{{
`<template>
    <Tabs>
        <Tab title="导航1">内容1</Tab>
        <Tab title="导航2">内容2</Tab>
        <Tab title="导航3">内容3</Tab>
    </Tabs> 
</template>

<script lang="ts">
import Tabs from '../lib/Tabs.vue'
import Tab from '../lib/Tab.vue'
export default {
    components: { Tabs, Tab }
}
</script>`
}}</code></pre>
            </main>
        </div>
    </div> 
</template>

<script>
import Tabs from '../lib/Tabs.vue'
import Tab from '../lib/Tab.vue'
import {ref} from "vue"
export default {
    components: { Tabs, Tab },
    setup(){
            const code=ref(false)
            const getCode=()=>{
                code.value=!code.value
            }
            return {code,getCode}
        }
}
</script>

<style lang="scss" scoped>
.wrapper{
    max-width:800px;
    h2{
        padding-bottom: 30px;
        border-bottom: 1px solid rgb(212, 208, 208);
    }
    .shape{
        margin:30px 0px;
        >h3{
            margin-bottom: 10px;
        }
        >div{
            display: flex;
            padding: 50px;
            align-items: center;
            justify-content: center;
            border:1px solid rgb(212, 208, 208);
        }
    }
}
</style>